package com.synesthesiaconsulting.gwt.widgets.lightbox.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.DOM;

import java.util.List;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 26, 2008
 * Time: 12:48:31 AM
 * To change this template use File | Settings | File Templates.
 */
public class LightBox extends Widget {
    List<Widget> widgets = new ArrayList<Widget>();

    public LightBox() {
        this.setElement(DOM.createDiv());
        this.setStyleName("lightbox");
        this.getElement().setInnerHTML("&nbsp;");
        

        //RootPanel.getBodyElement().appendChild(elem);
    }

    public void show() {
        RootPanel.getBodyElement().appendChild(this.getElement());
        for(int i = 0; i < widgets.size(); i++)
            RootPanel.getBodyElement().appendChild(widgets.get(i).getElement());
    }
    public void hide() {
        RootPanel.getBodyElement().removeChild(this.getElement());
        for(int i = 0; i < widgets.size(); i++)
            RootPanel.getBodyElement().removeChild(widgets.get(i).getElement());

    }

    public void addWidget(Widget w) {
        widgets.add(w);

    }
}
